package gov.kqqzyyy.monkey.tjpd.mytools;

import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.util.ArrayMap;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.socks.library.KLog;

import gov.kqqzyyy.monkey.tjpd.BuildConfig;


/**
 * Created by Monkey on 2017/12/20.
 * 自定义Application，存储全局变量
 */

public class MyApplication extends Application {

    private ArrayMap<String, String> deviceInfos;// 用来存储设备信息和异常信息
    private long deltaTime = 0;//与服务器时间差
    public static Context applicationContext;

    @Override
    public void onCreate() {
        super.onCreate();
//        CrashHandler.getInstance().init(this);
        Fresco.initialize(this);
        KLog.init(BuildConfig.LOG_DEBUG);
        applicationContext = this;
    }

    public long getDeltaTime() {
        return deltaTime;
    }

    public void setDeltaTime(long deltaTime) {
        this.deltaTime = deltaTime;
    }

    public ArrayMap<String, String> getDeviceInfos() {
        if (deviceInfos == null) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                return new ArrayMap<>();
            }
        }
        return deviceInfos;
    }

    public void setDeviceInfos(ArrayMap<String, String> deviceInfos) {
        this.deviceInfos = deviceInfos;
    }
    
}
